import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { createStyleImportPlugin, AntdResolve } from "vite-plugin-style-import";
import eslintPlugin from "vite-plugin-eslint";
import { resolve } from "path"; // pnpm i @types/node

export default defineConfig({
    plugins: [
        react(),
        createStyleImportPlugin({ resolves: [AntdResolve()] }),
        eslintPlugin() //  EsLint 报错信息显示在浏览器界面上 变量定义了没使用  页面也要报错
    ],
    resolve: {
        alias: {
            "@": resolve(__dirname, "./src"),
            "@less": resolve(__dirname, "./src/assets/less"),
            "@icons": resolve(__dirname, "./src/assets/icons"),
            "@images": resolve(__dirname, "./src/assets/images"),
            "@components": resolve(__dirname, "./src/components"),
            "@pages": resolve(__dirname, "./src/pages"),
            "@router": resolve(__dirname, "./src/router"),
            "@store": resolve(__dirname, "./src/store"),
            "@utils": resolve(__dirname, "./src/utils"),
            "@publicFunctions": resolve(__dirname, "./src/publicFunctions")
        }
    },
    css: {
        preprocessorOptions: {
            less: {
                javascriptEnabled: true
            }
        }
    },
    envDir: "./src/environments"
});
